import { get, post, put, del } from '@/common/utils/request';

/**
 * 宠物日程相关API
 */
const petScheduleApi = {
  /**
   * 根据宠物主人ID查询宠物日程列表
   * @param {number} ownerId - 宠物主人ID
   * @returns {Promise<ResultMessage<List<PetSchedule>>>}
   */
  getByOwnerId: (ownerId) => {
    return get(`/api/schedule/schedules/owner/${ownerId}`);
  },

  /**
   * 根据日程提醒ID查询宠物日程列表
   * @param {number} scheduleId - 日程提醒ID
   * @returns {Promise<ResultMessage<List<PetSchedule>>>}
   */
  getSchedulesByScheduleId: (scheduleId) => {
    return get(`/api/schedule/schedules/pet/${scheduleId}`);
  },

  /**
   * 根据日期和宠物主人ID查询宠物日程列表
   * @param {number} ownerId - 宠物主人ID
   * @param {Date} scheduleDate - 日程日期
   * @returns {Promise<ResultMessage<List<PetSchedule>>>}
   */
  getByDate: (ownerId, scheduleDate) => {
    return get(`/api/schedule/schedules/date/${ownerId}`, {
      params: { scheduleDate }
    });
  },

  /**
   * 添加宠物日程
   * @param {PetSchedule} schedule - 日程信息
   * @returns {Promise<ResultMessage<boolean>>}
   */
  add: (schedule) => {
    return post('/api/schedule/schedules/addSchedule', schedule);
  },

  /**
   * 更新宠物日程
   * @param {number} scheduleId - 日程ID
   * @param {PetSchedule} schedule - 更新后的日程信息
   * @returns {Promise<ResultMessage<boolean>>}
   */
  update: (scheduleId, schedule) => {
    return put(`/api/schedule/schedules/updateSchedule/${scheduleId}`, schedule);
  },

  /**
   * 删除宠物日程
   * @param {number} scheduleId - 日程ID
   * @returns {Promise<ResultMessage<boolean>>}
   */
  delete: (scheduleId) => {
    return del(`/api/schedule/schedules/deleteSchedule/${scheduleId}`);
  },
  /**
   * 根据宠物主人id查询信息
   */
  getUserById: (userId)=>{
	  return get(`/api/schedule/users/getUserById/${userId}`);
  },
  /**
   * 根据用户ID查询宠物列表
   */
  getPetsByOwnerId: (ownerId)=>{
	  return get(`/api/schedule/pet/owner/${ownerId}`);
  },
  /**
   * 根据宠物ID查询宠物详情
   */
  getPetById: (petId)=>{
	  return get(`/api/schedule/pet/getPetById/${petId}`);
  }
};

export default petScheduleApi;